<template>
    <div>
        收藏页
        <el-table
          
            :data="list"
            tooltip-effect="dark"
            style="width: 100%"
        >
            <el-table-column type="selection" width="55"> </el-table-column>
            <el-table-column label="商品名称" width="120" prop="product_name">
            </el-table-column>
            <el-table-column prop="name" label="图片" width="180">
                <template slot-scope="scope"
                    ><img
                        :src="
                            'http://47.115.85.237:3000/' +
                                scope.row.product_picture
                        "
                        alt=""
                        width="50px"
                        height="50px"
                /></template>
            </el-table-column>
            <el-table-column prop="product_price" label="价格">
            </el-table-column>
            <el-table-column prop="product_num" label="数量" width="180">
            </el-table-column>
            <el-table-column prop="product_intro" label="介绍" width="280">
            </el-table-column>
            <el-table-column label="操作" width="280">
                <template slot-scope="scope">
                    <el-button type="primary" @click="del(scope.row.product_id)"
                        >删除</el-button
                    >
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
export default {
    data() {
        return {
            list: [],
        };
    },

    mounted() {
        this.$axios
            .post("/api/user/collect/getCollect", {
                user_id: 1404,
            })
            .then((res) => {
                console.log(res);
                this.list = res.data.collectList;
            });
    },
    methods: {
        del(id) {
            console.log(id);
            this.$axios
                .post("/api/user/collect/deleteCollect", {
                    user_id: 1404,
                    product_id: id,
                })
                .then((res) => {
                    console.log(res);
                });
        },
    },
};
</script>
